// 1.定义一个Person类
class Person {
    name: string
    age: number
    constructor(name: string, age: number) {
        this.name = name
        this.age = age
    }
    sayName() {
        console.log(this.name);
    }
}

// 2.定义一个Student类  添加一个skill
// class Student {
//     name: string
//     age: number
//     skill: string
//     constructor(name: string, age: number, skill: string) {
//         this.name = name
//         this.age = age
//         this.skill = skill
//     }
//     saySkill(): void {
//         console.log(this.skill)
//     }
// }

class Student extends Person {
    skill: string
    // super指父类  只能放在子类构造函数第一行
    constructor(name: string, age: number, skill: string) {
        super(name, age)
        this.skill = skill
    }
    saySkill(): void {
        console.log(this.skill);
    }
}

var s: Student = new Student("lisi", 18, "vue");
console.log(s);
s.sayName();